/**
 * 动态渲染列中按钮
 * @param e
 * @returns {string}
 */
function onWorkCoordination(e) {
    var record = e.value;
    var arr = record.split("@");
    var secondState = arr[0];
    var state = arr[1];
    var isEqual = arr[2];//1表示当前司法厅与第三司法厅相同，0表示不同
    var s = "";
    if (secondState == "6" && state == "3") {//第三省份司法厅拒绝，上报省份司法厅内部指定司法所处理
        s += '&nbsp;<a class="mini-button mini-button-warning"  onclick="toDealOrigin()"  >&nbsp;&nbsp;处理&nbsp;&nbsp;</a>&nbsp';
    } else if (secondState == "4" && state == "-1") {//司法厅上报
        s += '&nbsp;<a class="mini-button mini-button-warning"  onclick="toApply()"  >&nbsp;&nbsp;上报&nbsp;&nbsp;</a>&nbsp';
    } else if (secondState == "4" && state == "0") {//司法厅上报信息查看
        s += '&nbsp;<a class="mini-button mini-button-success"  onclick="toView(1)"  >&nbsp;&nbsp;查看上报信息&nbsp;&nbsp;</a>&nbsp';
    } else if ((state == "1" || state == "3" || secondState == "6")) {//司法厅对司法部回复信息进行查看
        if (secondState != "7" && secondState != "5") {
            s += '&nbsp;<a class="mini-button mini-button-success"  onclick="toView(2)"  >&nbsp;&nbsp;查看协调信息&nbsp;&nbsp;</a>&nbsp';
        }
    }
    if (secondState == "4" && state == "1" && isEqual == "1") {//第三司法厅处理司法部协调信息，拒绝或同意
        s += '&nbsp;<a class="mini-button mini-button-warning"  onclick="toDeal()"  >&nbsp;&nbsp;处理&nbsp;&nbsp;</a>&nbsp';
    }
    if (secondState == "7" && state == "3") {//第三省份司法厅拒绝，上报省份司法厅内部指定司法所处理 完成后查看
        s += '&nbsp;<a class="mini-button mini-button-info"  onclick="toView(3)"  >&nbsp;&nbsp;查看&nbsp;&nbsp;</a>&nbsp';
    }
    if (secondState == "5" && state == "2") {//第三省份司法厅同意 原司法厅/第三司法厅  查看最终协调信息
        s += '&nbsp;<a class="mini-button mini-button-info"  onclick="toView(4)"  >&nbsp;&nbsp;查看&nbsp;&nbsp;</a>&nbsp';
    }
    s += '&nbsp;<a class="mini-button mini-button-success"  onclick="toViewArchives()"  >&nbsp;&nbsp;档案信息&nbsp;&nbsp;</a>&nbsp'
    return s;
}

/**
 * 上报
 */
function toApply() {
    var row = grid.getSelected();//获取列表行数据
    mini.open({
        url: "/azbj/ksywxt/apply?priNum=" + row.priNum,
        title: "回复", width: 600, height: 650,
        onload: function () {
        },
        ondestroy: function (action) {
            grid.reload();
        }
    });
}

/**
 * 第三省份司法厅拒绝，司法部回复后  上报省份司法厅内部指定司法所处理
 */
function toDealOrigin() {
    var row = grid.getSelected();//获取列表行数据
    mini.open({
        url: "/azbj/ksywxt/toDealOrigin?priNum=" + row.priNum,
        title: "处理", width: 600, height: 650,
        onload: function () {
        },
        ondestroy: function (action) {
            grid.reload();
        }
    });
}

/**
 * 协调的第三省司法厅处理：同意或拒绝
 */
function toDeal() {
    var row = grid.getSelected();//获取列表行数据
    mini.open({
        url: "/azbj/ksywxt/deal?priNum=" + row.priNum,
        title: "处理", width: 600, height: 650,
        onload: function () {
        },
        ondestroy: function (action) {
            grid.reload();
        }
    });
}

/**
 * 查看页面
 * 1、司法部回复查看
 * 2、第三省份司法厅拒绝进行处理完成查看
 */
function toView(e) {
    var row = grid.getSelected();//获取列表行数据
    mini.open({
        url: "/azbj/ksywxt/view?priNum=" + row.priNum + "&flag=" + e,
        title: "协调信息", width: 600, height: 650,
        onload: function () {
        },
        ondestroy: function (action) {
            grid.reload();
        }
    });
}

//档案信息查看
function toViewArchives() {
    var row = grid.getSelected();
    mini.open({
        url: "/azbj/bjdxInfo/hjqc/toViewTabs/view?priNum=" + row.priNum,
        title: "查看",
        width: "60%",
        height: "80%",
        allowDrag: true,
        allowResize: false,
        showCloseButton: true,
        onload: function () {
        },
        ondestroy: function (action) {
            grid.reload();
        }
    });
}